package com.prs.crm.domain.fs;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.BaseEntity;

@Entity
@Table(name="fs_acct")
public class Acct extends BaseEntity{

	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	@ManyToOne
	private AcctType type;
	private String name;
	private String flag;
	private String code;
	private String mold;
	private String mark;
	@ManyToOne
	private Acct upAcct;
	@OneToMany(fetch = FetchType.LAZY,mappedBy="upAcct")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Set<Acct> childs;
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public AcctType getType() {
		return type;
	}
	public void setType(AcctType type) {
		this.type = type;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getMold() {
		return mold;
	}
	public void setMold(String mold) {
		this.mold = mold;
	}
	public void setFlag(String flag) {
		this.flag = flag;
	}
	public String getFlag() {
		return flag;
	}
	public void setMark(String mark) {
		this.mark = mark;
	}
	public String getMark() {
		return mark;
	}
	public Acct getUpAcct() {
		return upAcct;
	}
	public void setUpAcct(Acct upAcct) {
		this.upAcct = upAcct;
	}
	public Set<Acct> getChilds() {
		return childs;
	}
	public void setChilds(Set<Acct> childs) {
		this.childs = childs;
	}
	
}
